import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { LayoutModule } from './layout/layout.module';
import { FormsModule } from '@angular/forms';
import { MyService } from './core/services/my-service.service';
import { CommonModule } from '@angular/common';
import { DisplayDateComponent } from './display-date/display-date.component';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet, LayoutModule, FormsModule, CommonModule, DisplayDateComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.less'
})
export class AppComponent {
  // val: string = 'GeeksforGeeks';
  // title = "Geeks";
  // classtype = "text-danger";
  // Geeks = "GeeksforGeeks";
  // image =
  //   "https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6.png";

  myNumber = 29;

  title = 'injectable-service-demo';

  items: any[] = [];

  constructor(private myService: MyService){
    this.items = this.myService.getData();
  }

  addItem() {
    const newItem = {id:Date.now(), value: 'New Item'};
    this.myService.addData(newItem);
    this.items = this.myService.getData();
  }
}
